<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>{$arc.title}-乡土卫士日志-最美乡村</title>  
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/detail.css" />
</head>
<body>
<div class="Article">
	<div class="titile">
    	<h2>{$arc.title}</h2>
        <div class="peo">
        	<div class="pic">
                    <eq name="arc.img" value="">
                <img src="__PUBLIC__/Uploads/user_info/default.jpg"/>
                    <else/>
                <img src="__PUBLIC__/Uploads/{$arc.img}"/>
                    </eq>
            </div>
            <h3><span>{$arc.name}</span><time>发布于{$arc.addtime|date='Y-m-d H:i',###}</time></h3>
            <b>乡土卫士</b>
        </div>
    </div>
    <div class="content">
    	<p>{$arc.content}</p>
        <h4><span id="supports">{$arc.diary_supports}</span><em>阅读{$arc.diary_clicks}</em></h4>
    </div>
    <div class="comment">
    	<ul>
        <volist name="com" id="vo">
        	<li>
            	<div class="pic">
                    <eq name="vo.img" value="">
                <img src="__PUBLIC__/wx/images/pic06.jpg"/>
                    <else/>
                <img src="__PUBLIC__/Uploads/{$vo.img}"/>
                    </eq>
                </div>
                <div class="matter">
                	<h4><span class="nickname">{$vo.nickname}</span><!--<b>地方贤达</b>-->
                    <em class="praise" data="{$vo.comments_id}" sup="{$vo.comments_supports}">{$vo.comments_supports}</em></h4>
                    <p>{$vo.content}</p>
                    <h5><time>{$vo.addtime|date='Y-m-d',###}</time>
                    <eq name="vo.num" value="0">
                    <a  onClick="replay({$vo.comments_id},'{$vo.nickname}',{$vo.u_id})">回复</a>
                    <else/>
                    <a href="__MODULE__/Article/reply/id/{$vo.comments_id}/">{$vo.num}条回复</a>
                    </eq>
                    </h5>
            	</div>
            </li>
         </volist>   
        </ul>
    </div>
    <div class="apply"><p><input type="hidden" value="{$arc.u_id}" name="r_u_id" /><input type="hidden" value="0" name="rid" /><input type="text" name="do-comments" placeholder="写评论"/><input type="button" value="发表" onClick="add_comments()"/></p></div>
</div>
<style type="text/css">
.content img{
	width:100%;
	}
</style>
	<script type="text/javascript" src="__PUBLIC__/wx/js/jquery-1.3.1.min.js"></script>
	<script type="text/javascript">
//文章增减-点赞
$("#supports").click(function(){
	if($(this).hasClass("zan")){
		$(this).removeClass("zan");
		$.get("__MODULE__/Article/diary_supports/id/{$arc.diary_id}/dowhat/dec/");
		$("#supports").text(Number($("#supports").text())-1);
	}else{
		$(this).addClass("zan");
		$.get("__MODULE__/Article/diary_supports/id/{$arc.diary_id}/dowhat/add/");
		$("#supports").text(Number($("#supports").text())+1);
		}
	});
//评论增减-点赞
$(".praise").click(function(){
	id=$(this).attr('data');//获取点赞的id
	if($(this).hasClass("praised")){
		$.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/dec/");
		$(this).text(Number($(this).attr('sup')));
		$(this).removeClass("praised");
	}else{
		$.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/add/");
		$(this).text(Number($(this).attr('sup'))+1);
		$(this).addClass("praised");
		}
	});
//评论
function add_comments(){
	if($("input[name='do-comments']").val()==''){alert("请输入评论！");return;}
	//增加，更新地址
    $.ajax({
    type : "POST",
    dataType : "json",
	data:{r_u_id:$("input[name='r_u_id']").val(),arc_type:'diary',arc_id:'{$arc.diary_id}',r_id:$("input[name='rid']").val(),content:$("input[name='do-comments']").val()},
    url: "__MODULE__/Article/comments/",
    async:false,
    success: function(data){
		if(data=='ok'){
			//alert("添加成功");
			location.reload();
			}else{
				alert(data);
			}
    }
	});//end ajax
}//end
function replay(id,nickname,r_u_id){
	$("input[name='rid']").val(id);	
	$("input[name='r_u_id']").val(r_u_id);	
	$("input[name='do-comments']").attr("placeholder","回复："+nickname);	
}//end fun
	</script>
</body>
</html>